Extensible and modular generics for the masses

نویسندگان

  • Bruno C. d. S. Oliveira
  • Ralf Hinze
  • Andres Löh
چکیده

A generic function is a function that is defined on the structure of data types: with a single definition, we obtain a function that works for many data types. In contrast, an ad-hoc polymorphic function requires a separate implementation for each data type. Previous work by Hinze on lightweight generic programming has introduced techniques that allow the definition of generic functions directly in Haskell. A severe drawback of these approaches is that generic functions, once defined, cannot be extended with ad-hoc behaviour for new data types, precluding the design of an extensible and modular generic programming library based on these techniques. In this paper, we present a revised version of Hinze’s Generics for the masses approach that overcomes this limitation. Using our new technique, writing an extensible and modular generic programming library in Haskell 98 is possible.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Libraries for Generic Programming in Haskell

These lecture notes introduce libraries for datatype-generic programming in Haskell. We introduce three characteristic generic programming libraries: lightweight implementation of generics and dynamics, extensible and modular generics for the masses, and scrap your boilerplate. We show how to use them to use and write generic programs. In the case studies for the different libraries we introduc...

متن کامل

Call-graph-based Optimizations in Scala Semester Project

Scala [3] provides various high-level features that programmers can utilize in order to write readable, modular, and extensible code in a productive manner. Generics, virtual methods, higher-order functions and higher-kinded types [7] are some of these features. As one could expect, most of them come with a cost, generally in the form of an overhead in runtime performance. Take for example the ...

متن کامل

A Sensor-Based Scheme for Activity Recognition in Smart Homes using Dempster-Shafer Theory of Evidence

This paper proposes a scheme for activity recognition in sensor based smart homes using Dempster-Shafer theory of evidence. In this work, opinion owners and their belief masses are constructed from sensors and employed in a single-layered inference architecture. The belief masses are calculated using beta probability distribution function. The frames of opinion owners are derived automatically ...

متن کامل

A Language for Generic Programming in the Large

Generic programming is an effective methodology for developing reusable software libraries. Many programming languages provide generics and have features for describing interfaces, but none completely support the idioms used in generic programming. To address this need we developed the language G. The central feature of G is the concept, a mechanism for organizing constraints on generics that i...

متن کامل

An Extensible State Machine Pattern for Interactive Applications

The state design pattern is the standard object-oriented programming idiom for implementing the state machine logic of interactive applications. While this pattern provides a number of advantages, it does not easily support the creation of extended state machines in subclasses. We describe the extensible state design pattern, which augments the traditional state pattern with a few additional co...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006